﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using MaxStudio.Concrete.DBUtility;
using System.Collections;


namespace MaxStudio.Concrete.Server.Service
{
    public class ServiceFactory
    {
        private static Hashtable services = new Hashtable();

        private static Object o = new Object();

        #region Normal Function 
        public static FunctionesService getFunctionesService()
        {
            if (services["FunctionesService"] != null)
                return (FunctionesService)services["FunctionesService"];
            else
            {
                FunctionesService service;
                lock (o)
                {
                    service = new FunctionesService();
                    services.Add("FunctionesService", service);
                }
                return service;
            }
        }

        public static FunctionGroupService getFunctionGroupService()
        {
            if (services["FunctionGroupService"] != null)
                return (FunctionGroupService)services["FunctionGroupService"];
            else
            {
                FunctionGroupService service;
                lock (o)
                {
                    service = new FunctionGroupService();
                    services.Add("FunctionGroupService", service);
                }
                return service;
            }
        }

        public static UserService getUserService()
        {
            if (services["UserService"] != null)
                return (UserService)services["UserService"];
            else
            {
                UserService service;
                lock (o)
                {
                    service = new UserService();
                    services.Add("UserService", service);
                }
                return service;
            }
        }

        public static MasterDataService getMasterDataService()
        {
            if (services["MasterDataService"] != null)
                return (MasterDataService)services["MasterDataService"];
            else
            {
                MasterDataService service;
                lock (o)
                {
                    service = new MasterDataService();
                    services.Add("MasterDataService", service);
                }
                return service;
            }
        } 

        public static CustomerService getCustomerService()
        {
            if (services["CustomerService"] != null)
                return (CustomerService)services["CustomerService"];
            else
            {
                CustomerService service;
                lock (o)
                {
                    service = new CustomerService();
                    services.Add("CustomerService", service);
                }
                return service;
            }
        }

        public static LinkmanService getLinkmanService()
        {
            if (services["LinkmanService"] != null)
                return (LinkmanService)services["LinkmanService"];
            else
            {
                LinkmanService service;
                lock (o)
                {
                    service = new LinkmanService();
                    services.Add("LinkmanService", service);
                }
                return service;
            }
        }

        public static RMVenderService getRMVenderService()
        {
            if (services["RMVenderService"] != null)
                return (RMVenderService)services["RMVenderService"];
            else
            {
                RMVenderService service;
                lock (o)
                {
                    service = new RMVenderService();
                    services.Add("RMVenderService", service);
                }
                return service;
            }
        }

        public static RMService getRMService()
        {
            if (services["RMService"] != null)
                return (RMService)services["RMService"];
            else
            {
                RMService service;
                lock (o)
                {
                    service = new RMService();
                    services.Add("RMService", service);
                }
                return service;
            }
        }

        public static ProductService getProductService()
        {
            if (services["ProductService"] != null)
                return (ProductService)services["ProductService"];
            else
            {
                ProductService service;
                lock (o)
                {
                    service = new ProductService();
                    services.Add("ProductService", service);
                }
                return service;
            }
        }

        public static ReceivableService getReceivableService()
        {
            if (services["ReceivableService"] != null)
                return (ReceivableService)services["ReceivableService"];
            else
            {
                ReceivableService service;
                lock (o)
                {
                    service = new ReceivableService();
                    services.Add("ReceivableService", service);
                }
                return service;
            }
        }

        public static MotorcadeService getMotorcadeService()
        {
            if (services["MotorcadeService"] != null)
                return (MotorcadeService)services["MotorcadeService"];
            else
            {
                MotorcadeService service;
                lock (o)
                {
                    service = new MotorcadeService();
                    services.Add("MotorcadeService", service);
                }
                return service;
            }
        }

        public static SalesOrderService getSalesOrderServices()
        {
            if (services["SalesOrderService"] != null)
                return (SalesOrderService)services["SalesOrderService"];
            else
            {
                SalesOrderService service;
                lock (o)
                {
                    service = new SalesOrderService();
                    services.Add("SalesOrderService", service);
                }
                return service;
            }
        }

        public static NeedPayService getNeedPayService()
        {
            if (services["NeedPayService"] != null)
                return (NeedPayService)services["NeedPayService"];
            else
            {
                NeedPayService service;
                lock (o)
                {
                    service = new NeedPayService();
                    services.Add("NeedPayService", service);
                }
                return service;
            }
        } 

        public static ProductOrderService getProductOrderService()
        {
            if (services["ProductOrderService"] != null)
                return (ProductOrderService)services["ProductOrderService"];
            else
            {
                ProductOrderService service;
                lock (o)
                {
                    service = new ProductOrderService();
                    services.Add("ProductOrderService", service);
                }
                return service;
            }
        }

        public static ReceivableDetailsService getReceivableDetailsService()
        {
            if (services["ReceivableDetailsService"] != null)
                return (ReceivableDetailsService)services["ReceivableDetailsService"];
            else
            {
                ReceivableDetailsService service;
                lock (o)
                {
                    service = new ReceivableDetailsService();
                    services.Add("ReceivableDetailsService", service);
                }
                return service;
            }
        }

        public static NeedPayDetailsService getNeedPayDetailsService()
        {
            if (services["NeedPayDetailsService"] != null)
                return (NeedPayDetailsService)services["NeedPayDetailsService"];
            else
            {
                NeedPayDetailsService service;
                lock (o)
                {
                    service = new NeedPayDetailsService();
                    services.Add("NeedPayDetailsService", service);
                }
                return service;
            }
        } 

        public static PumperService getPumperService()
        {
            if (services["PumperService"] != null)
                return (PumperService)services["PumperService"];
            else
            {
                PumperService service;
                lock (o)
                {
                    service = new PumperService();
                    services.Add("PumperService", service);
                }
                return service;
            }
        }

        public static TransportService getTransportService()
        {
            if (services["TransportService"] != null)
                return (TransportService)services["TransportService"];
            else
            {
                TransportService service;
                lock (o)
                {
                    service = new TransportService();
                    services.Add("TransportService", service);
                }
                return service;
            }
        }

        #endregion

        #region Report
        public static RPTDeviceUsingService getRPTDeviceUsingService()
        {
            if (services["RPTDeviceUsingService"] != null)
                return (RPTDeviceUsingService)services["RPTDeviceUsingService"];
            else
            {
                RPTDeviceUsingService service;
                lock (o)
                {
                    service = new RPTDeviceUsingService();
                    services.Add("RPTDeviceUsingService", service);
                }
                return service;
            }
        }

        public static RPTScrapConcreteService getScrapConcreteService()
        {
            if (services["RPTScrapConcreteService"] != null)
                return (RPTScrapConcreteService)services["RPTScrapConcreteService"];
            else
            {
                RPTScrapConcreteService service;
                lock (o)
                {
                    service = new RPTScrapConcreteService();
                    services.Add("RPTScrapConcreteService", service);
                }
                return service;
            }
        }

        public static RPTAdmixtureAllocateService getRPTAdmixtureAllocateService()
        {
            if (services["RPTAdmixtureAllocateService"] != null)
                return (RPTAdmixtureAllocateService)services["RPTAdmixtureAllocateService"];
            else
            {
                RPTAdmixtureAllocateService service;
                lock (o)
                {
                    service = new RPTAdmixtureAllocateService();
                    services.Add("RPTAdmixtureAllocateService", service);
                }
                return service;
            }
        }

        public static RPTAdmixturePowderService getRPTAdmixturePowderService()
        {
            if (services["RPTAdmixturePowderService"] != null)
                return (RPTAdmixturePowderService)services["RPTAdmixturePowderService"];
            else
            {
                RPTAdmixturePowderService service;
                lock (o)
                {
                    service = new RPTAdmixturePowderService();
                    services.Add("RPTAdmixturePowderService", service);
                }
                return service;
            }
        }

        public static RPTOpeningAppraisalService getRPTOpeningAppraisalService()
        {
            if (services["RPTOpeningAppraisalService"] != null)
                return (RPTOpeningAppraisalService)services["RPTOpeningAppraisalService"];
            else
            {
                RPTOpeningAppraisalService service;
                lock (o)
                {
                    service = new RPTOpeningAppraisalService();
                    services.Add("RPTOpeningAppraisalService", service);
                }
                return service;
            }
        }
        
        public static RPTSiteOpeningRecordsService getRPTSiteOpeningRecordsService()
        {
            if (services["RPTSiteOpeningRecordsService"] != null)
                return (RPTSiteOpeningRecordsService)services["RPTSiteOpeningRecordsService"];
            else
            {
                RPTSiteOpeningRecordsService service;
                lock (o)
                {
                    service = new RPTSiteOpeningRecordsService();
                    services.Add("RPTSiteOpeningRecordsService", service);
                }
                return service;
            }
        }

       public static RPTMixProportionDesignService getRPTMixProportionDesignService()
        {
            if (services["RPTMixProportionDesignService"] != null)
                return (RPTMixProportionDesignService)services["RPTMixProportionDesignService"];
            else
            {
                RPTMixProportionDesignService service;
                lock (o)
                {
                    service = new RPTMixProportionDesignService();
                    services.Add("RPTMixProportionDesignService", service);
                }
                return service;
            }
        }

       public static FactoryCertificateService getFactoryCertificateService()
        {
            if (services["FactoryCertificateService"] != null)
                return (FactoryCertificateService)services["FactoryCertificateService"];
            else
            {
                FactoryCertificateService service;
                lock (o)
                {
                    service = new FactoryCertificateService();
                    services.Add("FactoryCertificateService", service);
                }
                return service;
            }
        }

       public static RPTCementReviewService getRPTCementReviewService()
       {
           if (services["RPTCementReviewService"] != null)
               return (RPTCementReviewService)services["RPTCementReviewService"];
           else
           {
               RPTCementReviewService service;
               lock (o)
               {
                   service = new RPTCementReviewService();
                   services.Add("RPTCementReviewService", service);
               }
               return service;
           }
       }

       public static RPTSandInspectionService getRPTSandInspectionService()
       {
           if (services["RPTSandInspectionService"] != null)
               return (RPTSandInspectionService)services["RPTSandInspectionService"];
           else
           {
               RPTSandInspectionService service;
               lock (o)
               {
                   service = new RPTSandInspectionService();
                   services.Add("RPTSandInspectionService", service);
               }
               return service;
           }
       }

       public static RPTGravelInspectionService getRPTGravelInspectionService()
       {
           if (services["RPTGravelInspectionService"] != null)
               return (RPTGravelInspectionService)services["RPTGravelInspectionService"];
           else
           {
               RPTGravelInspectionService service;
               lock (o)
               {
                   service = new RPTGravelInspectionService();
                   services.Add("RPTGravelInspectionService", service);
               }
               return service;
           }
       }

       public static RPTAshReviewService getRPTAshReviewService()
       {
           if (services["RPTAshReviewService"] != null)
               return (RPTAshReviewService)services["RPTAshReviewService"];
           else
           {
               RPTAshReviewService service;
               lock (o)
               {
                   service = new RPTAshReviewService();
                   services.Add("RPTAshReviewService", service);
               }
               return service;
           }
       }

       public static RPTAdmixtureReviewService getRPTAdmixtureReviewService()
       {
           if (services["RPTAdmixtureReviewService"] != null)
               return (RPTAdmixtureReviewService)services["RPTAdmixtureReviewService"];
           else
           {
               RPTAdmixtureReviewService service;
               lock (o)
               {
                   service = new RPTAdmixtureReviewService();
                   services.Add("RPTAdmixtureReviewService", service);
               }
               return service;
           }
       }

       public static RPTCementStrengthService getRPTCementStrengthService()
       {
           if (services["RPTCementStrengthService"] != null)
               return (RPTCementStrengthService)services["RPTCementStrengthService"];
           else
           {
               RPTCementStrengthService service;
               lock (o)
               {
                   service = new RPTCementStrengthService();
                   services.Add("RPTCementStrengthService", service);
               }
               return service;
           }
       }

       public static RPTPhysicalPropertiesOfementTestService getRPTPhysicalPropertiesOfementTestService()
       {
           if (services["RPTPhysicalPropertiesOfementTestService"] != null)
               return (RPTPhysicalPropertiesOfementTestService)services["RPTPhysicalPropertiesOfementTestService"];
           else
           {
               RPTPhysicalPropertiesOfementTestService service;
               lock (o)
               {
                   service = new RPTPhysicalPropertiesOfementTestService();
                   services.Add("RPTPhysicalPropertiesOfementTestService", service);
               }
               return service;
           }
       }

       public static RPTSchoolConcreteTestService getRPTSchoolConcreteTestService()
       {
           if (services["RPTSchoolConcreteTestService"] != null)
               return (RPTSchoolConcreteTestService)services["RPTSchoolConcreteTestService"];
           else
           {
               RPTSchoolConcreteTestService service;
               lock (o)
               {
                   service = new RPTSchoolConcreteTestService();
                   services.Add("RPTSchoolConcreteTestService", service);
               }
               return service;
           }
       }

       public static RPTMaterialCostService getRPTMaterialCostService()
       {
           if (services["RPTMaterialCostService"] != null)
               return (RPTMaterialCostService)services["RPTMaterialCostService"];
           else
           {
               RPTMaterialCostService service;
               lock (o)
               {
                   service = new RPTMaterialCostService();
                   services.Add("RPTMaterialCostService", service);
               }
               return service;
           }
       } 

        public static RPTMixingProportionOfConcreteOrderService getRPTMixingProportionOfConcreteOrderService()
       {
           if (services["RPTMixingProportionOfConcreteOrderService"] != null)
               return (RPTMixingProportionOfConcreteOrderService)services["RPTMixingProportionOfConcreteOrderService"];
           else
           {
               RPTMixingProportionOfConcreteOrderService service;
               lock (o)
               {
                   service = new RPTMixingProportionOfConcreteOrderService();
                   services.Add("RPTMixingProportionOfConcreteOrderService", service);
               }
               return service;
           }
       }

        public static RPTTemperatureAndHumidityService getRPTTemperatureAndHumidityService()
        {
            if (services["RPTTemperatureAndHumidityService"] != null)
                return (RPTTemperatureAndHumidityService)services["RPTTemperatureAndHumidityService"];
            else
            {
                RPTTemperatureAndHumidityService service;
                lock (o)
                {
                    service = new RPTTemperatureAndHumidityService();
                    services.Add("RPTTemperatureAndHumidityService", service);
                }
                return service;
            }
        }

        public static RPTScrapConcreteService getRPTScrapConcreteService()
        {
            if (services["RPTScrapConcreteService"] != null)
                return (RPTScrapConcreteService)services["RPTScrapConcreteService"];
            else
            {
                RPTScrapConcreteService service;
                lock (o)
                {
                    service = new RPTScrapConcreteService();
                    services.Add("RPTScrapConcreteService", service);
                }
                return service;
            }
        }

        public static RPTFactoryCertificateService getRPTFactoryCertificateService()
        {
            if (services["RPTFactoryCertificateService"] != null)
                return (RPTFactoryCertificateService)services["RPTFactoryCertificateService"];
            else
            {
                RPTFactoryCertificateService service;
                lock (o)
                {
                    service = new RPTFactoryCertificateService();
                    services.Add("RPTFactoryCertificateService", service);
                }
                return service;
            }
        } 
        #endregion
    }
}
